var app = angular.module('myApp', ["ngRoute"]);
app.config(function($routeProvider) {
	$routeProvider.when('/', {
		templateUrl: 'home.html'
	}).when('/home', {
		templateUrl: 'home.html'
	}).when('/news', {
		templateUrl: 'news.html'
	}).when('/dish', {
		templateUrl: 'dish.html'
	}).when('/dish_detail/:id', {
		templateUrl: 'dish-detail.html'
	}).when('/news_detail', {
		templateUrl: 'news_detail.html'
	}).when('/join', {
		templateUrl: 'join.html'
	}).when('/food', {
		templateUrl: 'food.html'
	}).when('/foo', {
		templateUrl: 'food.html'
	}).when('/fd/:id', {
		templateUrl: 'food_detail.html'
	}).when('/prodetail/:id', {
		templateUrl: 'pro-detail.html'
	}).when('/pro', {
		templateUrl: 'pro.html'
	}).when('/rel', {
		templateUrl: 'rel.html'
	}).otherwise({
		templateUrl: 'home.html'
	})

});
app.controller('myCtrl',function($scope){
    $scope.bol1 = true;
	$scope.bol2 = false;
	$scope.bol3 = true;
	$scope.bol4 = true;
	$scope.nFun1 = function(){
		if($scope.bol1==false){
			$scope.bol1 = !$scope.bol1;
			$('.nav_class p').css('color','black');
		$scope.bol4 = true;
		}else{
	$scope.bol1 = false;
	$scope.bol2 = true;
	$scope.bol3 = true;
		$scope.bol4 = false;
	$('.nav_wrap p').css('color','black');
	$('.nav_class p').css('color','red');
		}
	
	};
	$scope.nFun2 = function(){
	$scope.bol1 = true;
	$scope.bol2 = false;
	$scope.bol3 = true;
    $scope.bol4 = true;
	$('.nav_wrap p').css('color','black');
	$('.nav_home p').css('color','red')
	};
	$scope.nFun3 = function(){
	$scope.bol1 = true;
	$scope.bol2 = true;
	$scope.bol3 = false;	
	$scope.bol4 = true;
	$('.nav_wrap p').css('color','black');
	$('.nav_join p').css('color','red')
	};
	
	$scope.nFun4 = function(){
		$scope.bol1 = true;
		$scope.bol4 = true;
		$('.nav_wrap p').css('color','black');
	}

	
})

app.controller('navCtrl',function($scope){
	

});
  //food详情跳转
  app.controller('detailCtrl',function($scope,$routeParams,$http){
         $scope.id = $routeParams.id;
         $scope.id2= $scope.id.substr(1)
        
         $http.get('../php/detail.php?id='+$scope.id2).success(function(data){
			$scope.detail = data;
//			  console.log($scope.detail)
		});
   });
   //火锅跳转火锅详情(带路由ID)
app.controller('dishdetailCtrl',function($scope,$http,$routeParams){
         $scope.id=$routeParams.id;
         $scope.id2=$scope.id.substr(1);
         $http.get('../php/dish_detail.php?id='+$scope.id2).success(function(data){
         	$scope.xx=data;
       	
         });
         })	
  app.controller('proidCtrl',function($scope,$http,$routeParams){
         $scope.id=$routeParams.id;
         $scope.id2=$scope.id.substr(1);
         $http.get('../php/pro-detail-top.php?id='+$scope.id2).success(function(data){
         	$scope.kk=data;
       	console.log(data);
         });
         })	
